#include "SFC_Inc.hpp"
#include "SFC_Object.h"

SFC_Object::SFC_Object()
{
	VisiableChanged.Bind(this->Visiable);
	EnableChanged.Bind(this->Enable);
	// SizeChanged.Bind(this->Size);
	SizeMemberChanged.Bind(this->Size.x);
	SizeMemberChanged.Bind(this->Size.y);
	SizeMemberChanged.Bind(this->Size.w);
	SizeMemberChanged.Bind(this->Size.h);
	SizeMemberChanged += {this, &SFC_Object::SetDurty};
	VisiableChanged += {this, &SFC_Object::SetDurty};
	EnableChanged += {this, &SFC_Object::SetDurty};
}

SFC_Object::~SFC_Object()
{
}

void SFC_Object::SetDurty()
{
	static SFC_Event PaintEvent;
	PaintEvent.Type = EventType::Window;
	PaintEvent.Window.Type = WindowEventType::Paint;
	PaintEvent.Forcus = {0, 0};
	this->Durty = true;
	// EventRouter(PaintEvent);
}

template<typename T>
bool SFC_Object::SetDurty(const T, T&)
{
	SetDurty();
	return true;
}

template<>
bool SFC_Object::SetDurty<std::string>(std::string, std::string&)
{
	SetDurty();
	return true;
}